package model.skill;

import utilities.*;
import model.Model;

public abstract class Skill extends Model implements Archiveable {

	private String name;
	private String skillType;
	
	public Skill()
	{
		super("default");
		skillType = null;
	}
	
	public Skill(String name, String skillType)
	{
		super(name);
		this.skillType = skillType;
	}
	
	@Override
	public boolean equals(Object obj)
	{
		boolean matching = false;
		Skill otherSkill = (Skill) obj;
		if(this.name.equals(otherSkill.getName()))
			if(this.skillType.equals(otherSkill.getSkillType()))
				matching = true;
		return matching;
	}
	
	public String getName()
	{
		return name;
	}
	
	public String getSkillType()
	{
		return skillType;
	}
	
	
	public Archive save() {
		Archive archive = new JSONArchive();
		
		archive.putAttribute("name", this.name);
		archive.putAttribute("skillType", this.skillType);
		
		return archive;
	}
	
	public void load(Archive archive) {
		this.name = archive.getAttribute("name");
		this.skillType = archive.getAttribute("skillType");
	}
	
}
